﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FileClean
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private List<string> searchPath;//需要扫描的路径

        private void 添加路径ToolStripMenuItem_Click(object sender, EventArgs e)
        {

            if (fbd.ShowDialog()==DialogResult.OK)
            {
                string path = fbd.SelectedPath ;
                if (!searchPath.Contains(path))
                {
                    listBoxPath.Items.Add(path);
                    searchPath.Add(path);
                }
            }

        }

        private void 删除路径ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string path = listBoxPath.SelectedItem.ToString();
            listBoxPath.Items.Remove(listBoxPath.SelectedItem);
            if (searchPath.Contains(path))
            {
                searchPath.Remove(path);
            }

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            searchPath = new List<string>();

        }
    }
}
